﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DrDimsLib.CoreSDK.Functionality
{
    using System.Text.RegularExpressions;
    using Management;

    public class IOUtilWorkFlow : IOUtilBase, IWorkFlow
    {
        private const string appRoadMap = "Simple测试程序 读取任意PC桌面上的第一个*.txt文件 分析文件内容";
        private const string appVersion = "0.0.0.1123";

        #region Interface - Doc.IRestfulWorkFlow
        /// <summary>
        /// V1版本先不做递归读取
        /// </summary>
        /// <param name="FolderPath"> 文件夹路径 </param>
        /// <param name="FExtTypes"> 文件扩展名的变参数组 .txt .sql ... </param>
        /// <returns> 消息提示 </returns>
        public IEnumerable<string> GetLoStreams(string FolderPath = null, params string[] FExtTypes)
        {
            // 扫描本地路径
            return ScanFolder(FolderPath, FExtTypes);
        }
        public IEnumerable<T> ReadAPIInterface<T>(string urlPath)
        {
            throw new NotImplementedException();
        }
        public string roadMap { get { return appRoadMap; } }
        public string version { get { return appVersion; } }
        #endregion

        #region LifeCycle & Override
        public override string ToString()
        {
            IWorkFlow inst = this;
            var buffer = new StringBuilder();
            var toInfoString = string.Empty;
            buffer.AppendFormat(
                @"项目.By[丁者诚昊] Proj[DrDimsLib.LINQToAutoDeploy 全自动化部署决绝方案] At{0}.", DateTime.Parse("2018.01.15 10:27:00"));
            buffer.AppendLine();
            buffer.AppendFormat("版本号.[{0}]", inst.version);
            buffer.AppendLine();
            buffer.AppendFormat("路线图.[{0}]", inst.roadMap);
            buffer.AppendLine();
            toInfoString = buffer.ToString();   
            return toInfoString;
        }
        public IOUtilWorkFlow()
        {
            reExp = new Regex(CLRExtension.RegExpRepository.urlExp);
        }
        /// <summary>
        /// 哈~
        /// </summary>
        /// <returns> 返回API描述字符串 </returns>
        public virtual string APISigUrlization()
        {
            return ToString() + appVersion + Path.PathSeparator + appRoadMap;
        }
        #endregion
    }
}
